﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities.IRepository;
using Entities;
using System.Windows.Forms;
using Entities.ThuQuy;

namespace BLL.BLL
{
    public class QuanLyHoaDon
    {
        public static void LoadNhanVien(ComboBox cbbNhanVien, List<NhanVien> ds)
        {
            cbbNhanVien.Items.Clear();
            foreach (var nv in ds)
                cbbNhanVien.Items.Add(nv);
            cbbNhanVien.DisplayMember = "TenNhanVien";
            cbbNhanVien.ValueMember = "IdNhanVien";
            cbbNhanVien.Items.Insert(0, "---Nhân viên---");
            cbbNhanVien.SelectedIndex = 0;
        }


        public static void LoadListView(ListView lvHoaDon, List<HoaDon> dshd)
        {
            lvHoaDon.Items.Clear();
            foreach (HoaDon hd in dshd)
            {
                ListViewItem lvItem = new ListViewItem(hd.MaHD);
                lvItem.SubItems.Add(hd.MaLoai.ToString());
                lvItem.SubItems.Add(hd.NgayLap.ToShortDateString());
                lvItem.SubItems.Add(hd.NguoiLap);
            }
        }
        public static void LoadVatPham(ComboBox cbbVatPham, List<ChiTietHoaDon> cthd)
        {
            ChiTietHoaDon ct= new ChiTietHoaDon();
            cbbVatPham.Items.Clear();
            if (ct.LoaiChi == 1)
            {
                foreach (var item in cthd)
                {
                    cbbVatPham.Items.Add(item);
                    cbbVatPham.DisplayMember = "MaCTHD";
                    cbbVatPham.ValueMember = "VatPham";
                    cbbVatPham.Items.Insert(0, "---Vật Phẩm---");
                    cbbVatPham.SelectedIndex = 0;
                }
            }
        }

        public static void LoadNhanVien(ComboBox cbbNguoiLap, INhanVienRepository nv)
        {
            throw new NotImplementedException();
        }
    }
}
